import { PageContainer } from '@ant-design/pro-components';
import { FormattedMessage, useIntl, SelectLang, setLocale } from '@umijs/max';
import { Button } from 'antd';

const Index = () => {
  const intl = useIntl();
  const msg = intl.formatMessage({
    id: 'welcome',
  });
  const title = intl.formatMessage({
    id: 'title',
  });

  return (
    <PageContainer
      ghost
      header={{
        title: title,
      }}
    >
      <FormattedMessage id="welcome"></FormattedMessage>
      <p>{msg}</p>

      <SelectLang />
      <Button onClick={() => setLocale('en-US', false)}>btn</Button>
      <Button onClick={() => setLocale('zh-CN', false)}>btn</Button>
    </PageContainer>
  );
};

export default Index;
